/* This file contains replication code for Chopra, Nguyen, and Vossler "Who are we up against? Heterogeneous group contests with incomplete information" */
/* The associated data file is "Group_Contest.dta" */
/* If you have comments or questions, contact Christian Vossler (cvossler@utk.edu) */
/* March 2025 */

// User-defined Stata commands employed: "outreg", "reghdfe". You will need to install these for all the code to run properly. 
// e.g., just type "help outreg" in the Stata command line to begin this process

/* SET DIRECTORY */
clear all
cd "D:\Research\Group contest\Analysis\"

/* LOAD DATA */
use "Group_Contest.dta"

/* create sampling weights */
//Group-level observations, all rounds
gen wt_g=.
replace wt_g = 136/112 if Group_t==1 & Incomplete==0 & Even==0  
replace wt_g = 68/48 if Group_t==1 & Incomplete==0 & Even==1 & Strong==1 
replace wt_g = 68/112 if Group_t==1 & Incomplete==0 & Even==1 & Strong==0  
replace wt_g = 140/140 if Cost_t==1 & Incomplete==0 & Even==0  
replace wt_g = 70/64 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==1  
replace wt_g = 70/76 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_g = 180/170 if Value_t==1 & Incomplete==0 & Even==0
replace wt_g = 90/102 if Value_t==1 & Incomplete==0 & Even==1 & Strong==1
replace wt_g = 90/88 if Value_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_g = 138/102 if Group_t==1 & Incomplete==1 & Strong==1 
replace wt_g = 138/174 if Group_t==1 & Incomplete==1 & Strong==0
replace wt_g = 220/236 if Cost_t==1 & Incomplete==1 & Strong==1 
replace wt_g = 220/204 if Cost_t==1 & Incomplete==1 & Strong==0 
replace wt_g = 180/177 if Value_t==1 & Incomplete==1 & Strong==1 
replace wt_g = 180/183 if Value_t==1 & Incomplete==1 & Strong==0 
//Individual-level observations, all rounds
gen wt_i=.
replace wt_i= wt_g if Cost_t==1 | Value_t==1
replace wt_i= 540/504 if Group_t==1 & Uneven==1 & Strong==1
replace wt_i= 180/168 if Group_t==1 & Uneven==1 & Strong==0
replace wt_i= 540/432 if Group_t==1 & Even==1 & Strong==1
replace wt_i= 180/336 if Group_t==1 & Even==1 & Strong==0
replace wt_i= 1080/918 if Group_t==1 & Incomplete==1 & Strong==1
replace wt_i= 360/522 if Group_t==1 & Incomplete==1 & Strong==0
//Group-level observations, last 10 rounds
gen wt_g10=.
replace wt_g10 = 65/50 if Group_t==1 & Incomplete==0 & Even==0  
replace wt_g10 = 32.5/30 if Group_t==1 & Incomplete==0 & Even==1 & Strong==1 
replace wt_g10 = 32.5/50 if Group_t==1 & Incomplete==0 & Even==1 & Strong==0  
replace wt_g10 = 70/66 if Cost_t==1 & Incomplete==0 & Even==0  
replace wt_g10 = 35/32 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==1  
replace wt_g10 = 35/42 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_g10 = 90/86 if Value_t==1 & Incomplete==0 & Even==0
replace wt_g10 = 45/48 if Value_t==1 & Incomplete==0 & Even==1 & Strong==1
replace wt_g10 = 45/46 if Value_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_g10 = 70/50 if Group_t==1 & Incomplete==1 & Strong==1 
replace wt_g10 = 70/90 if Group_t==1 & Incomplete==1 & Strong==0
replace wt_g10 = 138/102 if Cost_t==1 & Incomplete==1 & Strong==1 
replace wt_g10 = 138/174 if Cost_t==1 & Incomplete==1 & Strong==0 
replace wt_g10 = 90/92 if Value_t==1 & Incomplete==1 & Strong==1 
replace wt_g10 = 90/88 if Value_t==1 & Incomplete==1 & Strong==0 
//Individual-level observations, last 19 rounds
gen wt_i19=.
replace wt_i19= 513/468 if Group_t==1 & Uneven==1 & Strong==1
replace wt_i19= 171/156 if Group_t==1 & Uneven==1 & Strong==0
replace wt_i19= 513/432 if Group_t==1 & Even==1 & Strong==1
replace wt_i19= 171/312 if Group_t==1 & Even==1 & Strong==0
replace wt_i19 = 399/402 if Cost_t==1 & Incomplete==0 & Even==0  
replace wt_i19 = 199.5/186 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==1  
replace wt_i19 = 199.5/210 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_i19 = 513/480 if Value_t==1 & Incomplete==0 & Even==0
replace wt_i19 = 256.5/282 if Value_t==1 & Incomplete==0 & Even==1 & Strong==1
replace wt_i19 = 256.5/264 if Value_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_i19 = 1026/882 if Group_t==1 & Incomplete==1 & Strong==1 
replace wt_i19 = 342/486 if Group_t==1 & Incomplete==1 & Strong==0
replace wt_i19 = 627/672 if Cost_t==1 & Incomplete==1 & Strong==1 
replace wt_i19 = 627/582 if Cost_t==1 & Incomplete==1 & Strong==0 
replace wt_i19 = 513/501 if Value_t==1 & Incomplete==1 & Strong==1 
replace wt_i19 = 513/525 if Value_t==1 & Incomplete==1 & Strong==0 
//Group-level observations, pre-pandemic
gen wt_pp=.
replace wt_pp = 102/84 if Group_t==1 & Incomplete==0 & Even==0  
replace wt_pp = 51/36 if Group_t==1 & Incomplete==0 & Even==1 & Strong==1 
replace wt_pp = 51/84 if Group_t==1 & Incomplete==0 & Even==1 & Strong==0  
replace wt_pp = 140/140 if Cost_t==1 & Incomplete==0 & Even==0  
replace wt_pp = 70/64 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==1  
replace wt_pp = 70/76 if Cost_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_pp = 180/170 if Value_t==1 & Incomplete==0 & Even==0
replace wt_pp = 90/102 if Value_t==1 & Incomplete==0 & Even==1 & Strong==1
replace wt_pp = 90/88 if Value_t==1 & Incomplete==0 & Even==1 & Strong==0 
replace wt_pp = 102/78 if Group_t==1 & Incomplete==1 & Strong==1 
replace wt_pp = 102/126 if Group_t==1 & Incomplete==1 & Strong==0
replace wt_pp = 220/236 if Cost_t==1 & Incomplete==1 & Strong==1 
replace wt_pp = 220/204 if Cost_t==1 & Incomplete==1 & Strong==0 
replace wt_pp = 180/177 if Value_t==1 & Incomplete==1 & Strong==1 
replace wt_pp = 180/183 if Value_t==1 & Incomplete==1 & Strong==0 
//label weight variables
label var wt_g "Sampling weights; group-level outcomes; all 20 rounds"
label var wt_i "Sampling weights; individual-level outcomes; all 20 rounds"
label var wt_g10 "Sampling weights; group-level outcomes; last 10 rounds"
label var wt_i19 "Sampling weights; individual-level outcomes; last 19 rounds"
label var wt_pp "Sampling weights; group-level outcomes; pre-pandemic"

/* Define cluster variables */
gen cluster1=1 if (Round==1|Round==2)
replace cluster1=2 if (Round==3|Round==4)
replace cluster1=3 if (Round==5|Round==6)
replace cluster1=4 if (Round==7|Round==8)
replace cluster1=5 if (Round==9|Round==10)
replace cluster1=6 if (Round==11|Round==12)
replace cluster1=7 if (Round==13|Round==14)
replace cluster1=8 if (Round==15|Round==16)
replace cluster1=9 if (Round==17|Round==18)
replace cluster1=10 if (Round==19|Round==20)
replace cluster1=cluster1 + (SessionID-1)*10 // maintains independence across sessions
gen cluster2=1 if (Round==1)
replace cluster2=2 if (Round==2|Round==3)
replace cluster2=3 if (Round==4|Round==5)
replace cluster2=4 if (Round==6|Round==7)
replace cluster2=5 if (Round==8|Round==9)
replace cluster2=6 if (Round==10|Round==11)
replace cluster2=7 if (Round==12|Round==13)
replace cluster2=8 if (Round==14|Round==15)
replace cluster2=9 if (Round==16|Round==17)
replace cluster2=10 if (Round==18|Round==19)
replace cluster2=11 if (Round==20)
replace cluster2=cluster2 + (SessionID-1)*11 // maintains independence across sessions


** Table 4: Theoretical predictions and observed group-level effort
// row 1
sum GroupEffort if Cost_t==1 & Uneven== 1 & Strong==1 & id==1 // 75.04 
sum GroupEffort if Cost_t==1 & Uneven== 1 & Strong==0 & id==1 // 20.1
// row 2
sum GroupEffort if Cost_t==1 & Even== 1 & Strong==1 & id==1 // 80.80
sum GroupEffort if Cost_t==1 & Even== 1 & Strong==0 & id==1 // 49.43
// row 3
sum GroupEffort if Cost_t==1 & Incomplete==1 & Strong==1 & id==1 // 89.27
sum GroupEffort if Cost_t==1 & Incomplete==1 & Strong==0 & id==1 // 42.49
// row 4
sum GroupEffort if Value_t==1 & Uneven==1 & Strong==1 & id==1 // 70.69
sum GroupEffort if Value_t==1 & Uneven==1 & Strong==0 & id==1 // 27.05
// row 5
sum GroupEffort if Value_t==1 & Even==1 & Strong==1 & id==1 // 76.84
sum GroupEffort if Value_t==1 & Even==1 & Strong==0 & id==1 // 43.73
// row 6
sum GroupEffort if Value_t==1 & Incomplete==1 & Strong==1 & id==1 // 84.85
sum GroupEffort if Value_t==1 & Incomplete==1 & Strong==0 & id==1 // 51.69
// row 7
sum GroupEffort if Group_t==1 & Uneven==1 & Strong==1 & id==1 // 119.57
sum GroupEffort if Group_t==1 & Uneven==1 & Strong==0 & id==1 // 41.14
// row 8
sum GroupEffort if Group_t==1 & Even==1 & Strong==1 & id==1 // 128.5
sum GroupEffort if Group_t==1 & Even==1 & Strong==0 & id==1 // 51.91
// row 9
sum GroupEffort if Group_t==1 & Incomplete==1 & Strong==1 & id==1 // 118.49
sum GroupEffort if Group_t==1 & Incomplete==1 & Strong==0 & id==1 // 40.26


** Table 5: Description of data
dtable GroupEffort ProbWin IndivEffort EffortVariance ZeroEffort Strong Incomplete Even Cost_t Value_t Group_t RiskAverse Experience Female Round GPA L_Loss L_GroupEffort, title(Table 5. Description of Data) column(summary(mean (std. dev.))) export(Results\Table5.docx, as(docx) replace) varlabel nosample nformat(%9.2f)


** Table 6: Analysis of information effects (group effort)
// demean Round variable
sum Round if id==1
gen Round_m = Round - r(mean) if id==1
* Model (1)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete [pweight=wt_g] if id==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(1)") replace nodisplay statfont(fs12) title("Table 6. Analysis of group-level effort by contest type")
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (2)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even [pweight=wt_g] if id==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(2)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; uneven contests
test Group_t = Value_t
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (3)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_g] if id==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(3)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; uneven contests
test Group_t = Value_t
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete


** Table 7: Analysis of group-level effort across strong and weak groups, by type of contest
* Uneven
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m  [pweight=wt_g] if id==1 & Uneven==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") replace nodisplay statfont(fs12) title("Table 7. Analysis of group-level effort across strong and weak groups, by contest type")
// tests across source of advantage; weak groups
test Group_t = Value_t
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Even
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m  [pweight=wt_g] if id==1 & Even==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") replace nodisplay statfont(fs12) merge 
// tests across source of advantage; weak groups
test Group_t = Value_t
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Incomplete Information
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m  [pweight=wt_g] if id==1 & Incomplete==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\Table7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Info.") replace nodisplay statfont(fs12) merge 
// tests across source of advantage; weak groups
test Group_t = Value_t
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong


** Table 8: Free-riding behavior and intra-group variation in individual effort
global controls Round Experience RiskAverse Female GPA
* Free-riding
reghdfe ZeroEffort Group_t Incomplete 1.Group_t#1.Incomplete Strong 1.Group_t#1.Strong Even 1.Group_t#1.Even $controls [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\Table8.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Zero Effort") replace nodisplay statfont(fs12) title("Table 8. Free-riding behavior and intra-group variation in individual effort")
// some reported results
lincom Incomplete + 1.Group_t#1.Incomplete
lincom Strong + 1.Group_t#1.Strong
* within-group variance
reghdfe EffortVariance Group_t Incomplete 1.Group_t#1.Incomplete Strong 1.Group_t#1.Strong Even 1.Group_t#1.Even $controls [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\Table8.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Zero Effort") replace nodisplay statfont(fs12) merge
// some reported tests
test Even + 1.Group_t#1.Even =0 // group size: even versus uneven
test Strong + 1.Group_t#1.Strong=0 // group size: strong versus weak

/* APPENDIX */

** Table B1. Analysis of group-level effort by contest type (pre-pandemic)
// demean Round variable
drop Round_m
sum Round if id==1 & Post==0
gen Round_m = Round - r(mean) if id==1 & Post==0
* Model (1)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete [pweight=wt_pp] if id==1 & Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB1.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(1)") replace nodisplay statfont(fs12) title("Table B.1 Analysis of group-level effort by contest type (pre-pandemic)")
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (2)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even [pweight=wt_pp] if id==1 & Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB1.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(2)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; uneven contests
test Group_t = Value_t
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (3)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_pp] if id==1 & Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB1.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(3)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even


** Table B2: Analysis of group-level effort across strong and weak groups, by contest type (pre-pandemic)
// note: sampling weights are only approximate as they are based on full sample
* Uneven
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_pp] if id==1 & Uneven==1 & Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB2.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") replace nodisplay statfont(fs12) title("Table B.2 Analysis of group-level effort across strong and weak groups, by contest type (pre-pandemic)")
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Even
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_pp] if id==1 & Even==1 & Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB2.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") replace nodisplay statfont(fs12) merge 
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Incomplete Information
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_pp] if id==1 & Incomplete==1& Post==0, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB2.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Info.") replace nodisplay statfont(fs12) merge 
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong


** Table B3: Analysis of individual effort by contest type
// demean control variables for Models (3) and (4)
drop Round_m
foreach var in Experience RiskAverse Female GPA Round {
sum `var'
gen `var'_m = `var' - r(mean)
}
global controls_m Experience_m RiskAverse_m Female_m GPA_m
* Model (1)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\TableB3.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(1)") replace nodisplay statfont(fs12) title("Table B.3 Analysis of individual effort by contest type")
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (2)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\TableB3.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(2)") nodisplay statfont(fs12) merge
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (3)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even  1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m $controls_m [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\TableB3.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(3)") nodisplay statfont(fs12) merge
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (4)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even   1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m $controls_m 1.Incomplete#c.GPA_m [pweight=wt_i], cluster(SubjectID cluster1 cluster2)
// export results
outreg using "Results\TableB3.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(4)") nodisplay statfont(fs12) merge
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
// effect of GPA on incomplete information contests
lincom GPA_m + 1.Incomplete#c.GPA_m

** Table B4. Analysis of individual effort across strong and weak groups, by contest type
// deamean covariates by contest type
foreach var in Experience RiskAverse Female Round GPA {
sum `var' if Uneven==1
gen `var'_U = `var' - r(mean) if Uneven==1
}
global controls_U 1.Cost#c.Round_U 1.Value#c.Round_U 1.Group_t#c.Round_U Experience_U RiskAverse_U Female_U GPA_U 
foreach var in Experience RiskAverse Female Round GPA {
sum `var' if Even==1
gen `var'_E = `var' - r(mean) if Even==1
}
global controls_E 1.Cost#c.Round_E 1.Value#c.Round_E 1.Group_t#c.Round_E Experience_E RiskAverse_E Female_E GPA_E 
foreach var in Experience RiskAverse Female Round GPA {
sum `var' if Incomplete==1
gen `var'_I = `var' - r(mean) if Incomplete==1
}
global controls_I 1.Cost_t#c.Round_I 1.Value_t#c.Round_I 1.Group_t#c.Round_I Experience_I RiskAverse_I Female_I GPA_I 
* Uneven contest
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong [pweight=wt_i] if Uneven==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") replace nodisplay statfont(fs12) title("Table B.4 Analysis of individual effort across strong and weak groups, by contest type") landscape
* Uneven contest (controls)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_U [pweight=wt_i] if Uneven==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") nodisplay statfont(fs12) merge landscape
* Even contest
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong [pweight=wt_i] if Even==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") nodisplay statfont(fs12) merge landscape
* Even contest (controls)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_E [pweight=wt_i] if Even==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") nodisplay statfont(fs12) merge landscape
* Incomplete information
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong [pweight=wt_i] if Incomplete==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Information") nodisplay statfont(fs12) merge landscape
* Incomplete information (controls)
reghdfe IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_I [pweight=wt_i] if Incomplete==1, cluster(SubjectID cluster1 cluster2)
outreg using "Results\TableB4.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Information") nodisplay statfont(fs12) merge landscape


** Table B5. Analysis of individual effort by contest type (Tobit)
global controls_m Experience_m RiskAverse_m Female_m GPA_m
* Model (1)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete [pweight=wt_i], vce(cluster SubjectID) ll(0)
// export results
outreg using "Results\TableB5.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(1)") replace nodisplay statfont(fs12) title("Table B.5 Analysis of individual effort by contest type (Tobit)") summstat(N \ r2_p)
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (2)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even [pweight=wt_i], vce(cluster SubjectID) ll(0)
// export results
outreg using "Results\TableB5.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(2)") nodisplay statfont(fs12) merge summstat(N \ r2_p)
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
**# Bookmark #2
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (3)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even  1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m $controls_m [pweight=wt_i], vce(cluster SubjectID) ll(0)
// export results
outreg using "Results\TableB5.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(3)") nodisplay statfont(fs12) merge summstat(N \ r2_p)
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (4)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even   1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m $controls_m 1.Incomplete#c.GPA_m [pweight=wt_i], vce(cluster SubjectID) ll(0)
// export results
outreg using "Results\TableB5.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(4)") nodisplay statfont(fs12) merge summstat(N \ r2_p)
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
// effect of GPA on incomplete information contests
lincom GPA_m + 1.Incomplete#c.GPA_m


** Table B6. Analysis of individual effort across strong and weak groups, by contest type (Tobit)
// Model (1)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_U [pweight=wt_i] if Uneven==1, ll(0) vce(cluster SubjectID)
outreg using "Results\TableB6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") replace nodisplay statfont(fs12) title("Table B.6 Analysis of individual effort across strong and weak groups, by contest type (Tobit)") summstat(N \ r2_p)
// Model (2)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_E [pweight=wt_i] if Even==1, ll(0) vce(cluster SubjectID)
outreg using "Results\TableB6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") replace nodisplay statfont(fs12) merge summstat(N \ r2_p) 
// Model (3)
tobit IndivEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong $controls_I [pweight=wt_i] if Incomplete==1, ll(0) vce(cluster SubjectID)
outreg using "Results\TableB6.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Info.") replace nodisplay statfont(fs12) merge summstat(N \ r2_p)


** Table B7. Analysis of group-level effort, by contest type (last 10 rounds)
// demean Round variable
sum Round if id==1 & Round>10
gen Round_m10 = Round - r(mean) if id==1 & Round>10
* Model (1)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete [pweight=wt_g10] if id==1 & Round>10, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(1)") replace nodisplay statfont(fs12) title("Table B.7 Analysis of group-level effort, by contest type (last 10 rounds)")
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
* Model (2)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even [pweight=wt_g10] if id==1 & Round>10, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(2)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even
* Model (3)
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Incomplete 1.Value_t#1.Incomplete 1.Group_t#1.Incomplete 1.Cost_t#1.Even 1.Value_t#1.Even 1.Group_t#1.Even 1.Cost_t#c.Round_m10 1.Value_t#c.Round_m10 1.Group_t#c.Round_m10 [pweight=wt_g10] if id==1 & Round>10, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB7.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "(3)") nodisplay statfont(fs12) merge
// tests across incomplete and even contests
test 1.Value_t#1.Incomplete = 1.Value_t#1.Even
test 1.Cost_t#1.Incomplete = 1.Cost_t#1.Even
test 1.Group_t#1.Incomplete = 1.Group_t#1.Even
// tests across source of advantage; incomplete information
test Group_t + 1.Group_t#1.Incomplete = 1.Cost_t#1.Incomplete
test Group_t + 1.Group_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
test 1.Cost_t#1.Incomplete = Value_t + 1.Value_t#1.Incomplete
// tests across source of advantage; even contests
test Group_t + 1.Group_t#1.Even = 1.Cost_t#1.Even
test Group_t + 1.Group_t#1.Even = Value_t + 1.Value_t#1.Even
test 1.Cost_t#1.Even = Value_t + 1.Value_t#1.Even


** Table B8. Analysis of group-level effort across strong and weak groups, by contest type (last 10 rounds)
* Uneven
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m10 1.Value_t#c.Round_m10 1.Group_t#c.Round_m10  [pweight=wt_g10] if id==1 & Uneven==1 & Round>10, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB8.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Uneven") replace nodisplay statfont(fs12) title("Table B.8 Analysis of group-level effort across strong and weak groups, by contest type (last 10 rounds)")
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Even
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m10 1.Value_t#c.Round_m10 1.Group_t#c.Round_m10  [pweight=wt_g10] if id==1 & Even==1 & Round>10, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB8.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Even") nodisplay statfont(fs12) merge 
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong
* Incomplete Information
reghdfe GroupEffort Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m10 1.Value_t#c.Round_m10 1.Group_t#c.Round_m10  [pweight=wt_g10] if id==1 & Incomplete==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB8.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(2) ctitle("", "Incomplete Info.") nodisplay statfont(fs12) merge 
// tests across source of advantage; Strong groups
test Group_t + 1.Group_t#1.Strong = 1.Cost_t#1.Strong
test Group_t + 1.Group_t#1.Strong = Value_t + 1.Value_t#1.Strong
test 1.Cost_t#1.Strong = Value_t + 1.Value_t#1.Strong


** Table B9. Analysis of probability of winning in uneven contests
// demean variable 'Round'
drop Round_m
sum Round if id==1
gen Round_m = Round - r(mean) if id==1
* Complete information
reghdfe ProbWin Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_g] if Uneven==1 & id==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB9.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Complete Info.") replace nodisplay statfont(fs12) title("Table B.9 Analysis of probability of winning in uneven contests")
* Incomplete information 
reghdfe ProbWin Value_t Group_t 1.Cost_t#1.Strong 1.Value_t#1.Strong 1.Group_t#1.Strong 1.Cost_t#c.Round_m 1.Value_t#c.Round_m 1.Group_t#c.Round_m [pweight=wt_g] if Uneven_Incomplete==1 & id==1, cluster(cluster1 cluster2)
// export results
outreg using "Results\TableB9.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Incomplete Info.") nodisplay statfont(fs12) merge


** Table B10. Free-riding behavior (Probit model)
global controls Round Experience RiskAverse Female GPA
gen Group_Incomplete=Group_t*Incomplete
gen Group_Strong=Group_t*Strong
gen Group_Even=Group_t*Even
probit ZeroEffort 1.Group_t 1.Incomplete Group_Incomplete 1.Strong Group_Strong 1.Even Group_Even $controls [pweight=wt_i], cluster(SubjectID)
// some results
lincom 1.Incomplete + Group_Incomplete
lincom 1.Strong + Group_Strong
// export results
outreg using "Results\TableB10.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Coefficients") replace nodisplay statfont(fs12) title("Table B.10 Free-riding behavior (Probit model)") 
// obtain marginal effects
margins, dydx(*) post
// export results
outreg using "Results\TableB10.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Marginal Effects") merge nodisplay statfont(fs12) 


** Table B11. Analysis of individual effort: dynamics
global controls Round Experience RiskAverse Female GPA
* Model controlling for prior loss
reghdfe IndivEffort Group_t Incomplete 1.Group_t#1.Incomplete Strong 1.Group_t#1.Strong Even 1.Group_t#1.Even L_Loss 1.L_Loss#1.Incomplete 1.L_Loss#1.Even $controls [pweight=wt_i19], cluster(SubjectID cluster1 cluster2)
// some tests
lincom L_Loss + 1.L_Loss#1.Incomplete
lincom L_Loss + 1.L_Loss#1.Even
// export results
outreg using "Results\TableB11.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Prior Loss") replace nodisplay statfont(fs12) title("Table B.11 Analysis of individual effort: behavioral dynamics")
* Model controlling for group effort from prior round
reghdfe IndivEffort Group_t Incomplete 1.Group_t#1.Incomplete Strong 1.Group_t#1.Strong Even 1.Group_t#1.Even L_GroupEffort c.L_GroupEffort#1.Incomplete c.L_GroupEffort#1.Even $controls [pweight=wt_i19], cluster(SubjectID cluster1 cluster2)
// some tests
lincom L_GroupEffort + c.L_GroupEffort#1.Incomplete 
lincom L_GroupEffort + c.L_GroupEffort#1.Even
// export results
outreg using "Results\TableB11.doc", stat(b se) starlevels(10 5 1) starloc(1) bdec(3) ctitle("", "Prior Group Effort") merge nodisplay statfont(fs12)


// FIGURES

*** Trends for Contribution
// AGG CONTRIBUTION OVER TIME
// cost
gen agg_contri_S_C = GroupEffort if Strong==1 & Cost_t==1 // 1110 obs.
gen agg_contri_W_C = GroupEffort if Strong==1 & Cost_t==1 // 1110 obs.
// value
gen agg_contri_S_V = GroupEffort if Strong==1 & Value_t==1 // 1092 obs.
gen agg_contri_W_V = GroupEffort if Strong==0 & Value_t==1 // 1068 obs.
// group size
gen agg_contri_S_G = GroupEffort if Strong==1 & Group_t==1 // 1854 obs.
gen agg_contri_W_G = GroupEffort if Strong==0 & Group_t==1 // 1026 obs.

// MEAN AGGREGATE CONTRIBUTION - BY TREATMENTS AND TYPES
// Uneven

*** Strong
bysort Round: egen CC_Uneven_S = mean(GroupEffort) if Strong==1 & Cost_t==1 & Incomplete==0 & Even==0
bysort Round: egen CV_Uneven_S = mean(GroupEffort) if Strong==1 & Value_t==1 & Incomplete==0 & Even==0
bysort Round: egen CG_Uneven_S = mean(GroupEffort) if Strong==1 & Group_t==1 & Incomplete==0 & Even==0
*** Weak
bysort Round: egen CC_Uneven_W = mean(GroupEffort) if Strong==0 & Cost==1 & Incomplete==0 & Even==0
bysort Round: egen CV_Uneven_W = mean(GroupEffort) if Strong==0 & Value_t==1 & Incomplete==0 & Even==0
bysort Round: egen CG_Uneven_W = mean(GroupEffort) if Strong==0 & Group_t==1 & Incomplete==0 & Even==0

// Even 
bysort Round: egen CC_Even_S = mean(GroupEffort) if Strong==1 & Cost_t==1 & Incomplete==0 & Even==1
bysort Round: egen CV_Even_S = mean(GroupEffort) if Strong==1 & Value_t==1 & Incomplete==0 & Even==1
bysort Round: egen CG_Even_S = mean(GroupEffort) if Strong==1 & Group_t==1 & Incomplete==0 & Even==1

*** Weak
bysort Round: egen CC_Even_W = mean(GroupEffort) if Strong==0 & Cost==1 & Incomplete==0 & Even==1
bysort Round: egen CV_Even_W = mean(GroupEffort) if Strong==0 & Value_t==1 & Incomplete==0 & Even==1
bysort Round: egen CG_Even_W = mean(GroupEffort) if Strong==0 & Group_t==1 & Incomplete==0 & Even==1

// Incomplete 
*** Strong 
bysort Round: egen IC_S = mean(GroupEffort) if Strong==1 & Cost_t==1 & Incomplete==1
bysort Round: egen IV_S = mean(GroupEffort) if Strong==1 & Value_t==1 & Incomplete==1
bysort Round: egen IG_S = mean(GroupEffort) if Strong==1 & Group_t==1 & Incomplete==1

*** Weak
bysort Round: egen IC_W = mean(GroupEffort) if Strong==0 & Cost_t==1 & Incomplete==1
bysort Round: egen IV_W = mean(GroupEffort) if Strong==0 & Value_t==1 & Incomplete==1 
bysort Round: egen IG_W = mean(GroupEffort) if Strong==0 & Group_t==1 & Incomplete==1

// NASH EQUILIBRIUM PREDICTED - self interest
// COMPLETE - cost and value
gen NASH_C_S = 28.125 if Strong==1 
gen NASH_C_W = 9.375 if Strong==0 
// INCOMPLETE
gen NASH_I_S = 32.812 if Strong==1
gen NASH_I_W = 10.937 if Strong==0
//GROUP SIZE 
gen NASH_Group = 12.5 if Group_t==1 // same for strong or weak


label var CC_Uneven_S "Cost" // Agg avg contri CC only
label var NASH_C_S "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 
label var CV_Uneven_S "Value" // Agg avg contri CV only
label var CG_Uneven_S "Group" // Agg avg contri CG only
label var Round "Round"

//TREND 1 - Uneven, Strong
twoway (line CC_Uneven_S Round, sort) (line NASH_C_S Round, sort) (line CV_Uneven_S Round, sort) (line NASH_Group Round, sort) (line CG_Uneven_S Round, sort), yscale(range(0 150)) ylabel(0(50)150) legend(position(6) cols(2))

label var CC_Uneven_W "Cost" // Agg avg contri CC only
label var NASH_C_W "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 
label var CV_Uneven_W "Value" // Agg avg contri CV only
label var CG_Uneven_W "Group" // Agg avg contri CG only
label var Round "Round"

//TREND 2 - Uneven, Weak
twoway (line CC_Uneven_W Round, sort) (line NASH_C_W Round, sort) (line CV_Uneven_W Round, sort) (line NASH_Group Round, sort) (line CG_Uneven_W Round, sort)    , yscale(range(0 150)) ylabel(0(50)150) legend(position(6) cols(2))

label var CC_Even_S "Cost" // Agg avg contri CC only
label var NASH_C_S "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 
label var CV_Even_S "Value" // Agg avg contri CV only
label var CG_Even_S "Group" // Agg avg contri CG only
label var Round "Round"

//TREND 3 - Even, Strong
twoway (line CC_Even_S Round, sort) (line NASH_C_S Round, sort) (line CV_Even_S Round, sort) (line NASH_Group Round, sort) (line CG_Even_S Round, sort)  , yscale(range(0 150)) ylabel(0(50)150)  legend(position(6) cols(2))

label var CC_Even_W "Cost" // Agg avg contri CC only
label var NASH_C_W "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 
label var CV_Even_W "Value" // Agg avg contri CV only
label var CG_Even_W "Group" // Agg avg contri CG only
label var Round "Round"

//TREND 4 - Even, Weak
twoway (line CC_Even_W Round, sort) (line NASH_C_W Round, sort) (line CV_Even_W Round, sort) (line NASH_Group Round, sort) (line CG_Even_W Round, sort)   , yscale(range(0 150)) ylabel(0(50)150) legend(position(6) cols(2))

label var IC_S "Cost" // IC only
label var IV_S "Value" // IV only
label var IG_S"Group" // IG only
label var NASH_I_S "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 

//TREND 5 - Incomplete, Strong
twoway (line IC_S Round, sort)  (line NASH_Group Round, sort) (line IV_S Round, sort) (line NASH_I_S Round, sort)  (line IG_S Round, sort) , yscale(range(0 150)) ylabel(0(50)150) legend(position(6) cols(2))

label var IC_W "Cost" // IC only
label var IV_W "Value" // IV only
label var IG_W "Group" // IG only
label var NASH_I_W "Nash equilibrium (Cost & Value)" // theory => CV CC same
label var NASH_Group "Nash equilibrium (Group)" // 

//TREND 6 - Incomplete, Weak
twoway (line IC_W Round, sort) (line NASH_I_W Round, sort) (line IV_W Round, sort) (line NASH_Group Round, sort) (line IG_W Round, sort) , yscale(range(0 150)) ylabel(0(50)150) legend(position(6) cols(2))




